import { Shop } from './shop.entity'
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinTable, ManyToMany } from 'typeorm'
import { ShopWork } from './shop-work.entity'
@Entity()
export class ShopEmployee {
  @PrimaryGeneratedColumn()
  id: number

  @Column({
    comment: '用户名',
    unique: true
  })
  name: string

  @Column({
    comment: '密码'
  })
  password: string

  @Column({
    comment: '年龄'
  })
  age: number

  @Column({
    comment: '地址'
  })
  address: string

  @ManyToOne(type => Shop, shop => shop.employees, { cascade: true })
  @JoinTable()
  shop: Shop

  // 施工者
  @ManyToMany(type => ShopWork, work => work.employees)
  works: ShopWork[]
}
